package org.example.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.fault.retry.RetryStrategyKeys;
import org.example.fault.tolerant.TolerantStrategy;
import org.example.fault.tolerant.TolerantStrategyKeys;
import org.example.loadbalancer.LoadBalancerKeys;
import org.example.serializer.SerializerKeys;

/**
 * RPC框架配置
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class RpcConfig {


    /**
     * 名称
     */
    private String name = "ikun-rpc";

    /**
     * 版本号
     */
    private String version = "1.0";

    /**
     * 模拟调用
     * 默认false表示关闭mock服务
     */
    private boolean mock = false;


    /**
     * 服务器主机名
     */
    private String serverHost = "localhost";

    /**
     * 服务器端口号
     */
    private Integer serverPort = 8080;

    /**
     * 序列化器，默认是JDK
     */
    private String serializer = SerializerKeys.JDK;

    /**
     * 注册中心配置
     */
    private RegistryConfig registryConfig = new RegistryConfig();

    /**
     * 负载均衡器
     */
    private String loadBalancer = LoadBalancerKeys.ROUND_ROBIN;

    /**
     * 重试策略
     */
    private String retryStrategy = RetryStrategyKeys.NO;

    /**
     * 容错策略
     */
    private String tolerantStrategy = TolerantStrategyKeys.FAIL_FAST;
}
